include(AwsTestHarness)
enable_testing()
include(CTest)

file(GLOB TEST_SRC "*.cpp")
file(GLOB TEST_HDRS "*.h")
file(GLOB TESTS ${TEST_HDRS} ${TEST_SRC})

set(TEST_BINARY_NAME ${PROJECT_NAME}-tests)

add_test_case(EventLoopResourceSafety)
add_net_test_case(MqttClientResourceSafety)
add_net_test_case(MqttClientNewConnectionUninitializedTlsContext)
add_test_case(ClientBootstrapResourceSafety)
add_net_test_case(TLSContextResourceSafety)
add_net_test_case(TLSContextUninitializedNewConnectionOptions)
add_test_case(Base64RoundTrip)
add_test_case(DateTimeBinding)
add_test_case(BasicJsonParsing)
add_test_case(JsonNullParsing)
add_test_case(JsonNullNestedObject)
add_test_case(JsonExplicitNull)
add_test_case(SHA256ResourceSafety)
add_test_case(MD5ResourceSafety)
add_test_case(SHA256HMACResourceSafety)
add_net_test_case(HttpDownloadNoBackPressureHTTP1_1)
add_net_test_case(HttpDownloadNoBackPressureHTTP2)
add_net_test_case(HttpStreamUnActivated)
add_net_test_case(IotPublishSubscribe)
add_net_test_case(HttpClientConnectionManagerResourceSafety)
add_net_test_case(HttpClientConnectionWithPendingAcquisitions)
add_net_test_case(HttpClientConnectionWithPendingAcquisitionsAndClosedConnections)
add_test_case(DefaultResolution)
add_test_case(OptionalCopySafety)
add_test_case(OptionalMoveSafety)
add_test_case(OptionalCopyAndMoveSemantics)
add_test_case(StreamTestCreateDestroyWrapper)
add_test_case(StreamTestLength)
add_test_case(StreamTestRead)
add_test_case(StreamTestReadEmpty)
add_test_case(StreamTestSeekBegin)
add_test_case(StreamTestSeekEnd)
add_test_case(TestCredentialsConstruction)
add_test_case(TestProviderStaticGet)
add_test_case(TestProviderEnvironmentGet)
add_test_case(TestProviderProfileGet)
add_test_case(TestProviderImdsGet)
add_test_case(TestProviderDefaultChainGet)
add_test_case(HttpRequestTestCreateDestroy)
add_test_case(Sigv4SigningTestCreateDestroy)
add_test_case(Sigv4SigningTestSimple)
add_test_case(Sigv4SigningTestCredentials)
add_test_case(Sigv4SigningTestUnsignedPayload)
add_test_case(UUIDToString)
add_test_case(TestIntArrayListToVector)
add_test_case(TestByteCursorArrayListToVector)
add_test_case(StringViewTest)
add_test_case(TestCreatingImdsClient)

if (AWS_BUILDING_ON_EC2)
    add_test_case(TestImdsClientGetInstanceInfo)
    add_test_case(TestImdsClientGetCredentials)
endif()

generate_cpp_test_driver(${TEST_BINARY_NAME})

add_custom_command(TARGET ${TEST_BINARY_NAME} PRE_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_directory
        ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:${TEST_BINARY_NAME}>)
